package com.haust.item.com.sxt.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface ItemMapper4Search {

    @Select("SELECT  i.id , i.title , i.sell_point as sellPoint , " +
            " i.price , i.image , IFNULL(c.name,'')  as categoryName ,IFNULL(d.item_desc,'')  as itemDesc ," +
            " i.updated" +
            " FROM tb_item i LEFT JOIN" +
            " tb_item_cat c ON" +
            " i.cid=c.id LEFT JOIN" +
            " tb_item_desc d ON" +
            " i.id=d.item_id")
    List<Map<String, Object>> selectItem4Search();


    @Select("SELECT  i.id , i.title , i.sell_point as sellPoint , " +
            " i.price , i.image , IFNULL(c.name,'')  as categoryName ,IFNULL(d.item_desc,'')  as itemDesc ," +
            " i.updated" +
            " FROM tb_item i LEFT JOIN" +
            " tb_item_cat c ON" +
            " i.cid=c.id LEFT JOIN" +
            " tb_item_desc d ON" +
            " i.id=d.item_id " +
            " where i.id=#{itemId}")
    Map<String, Object> selectItem4SearchById(Long itemId);
}
